package com.founder.gateway.component.transport.netty.filter;

import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;

import org.setu.framework.extension.SetuExtensionLoader;

import com.founder.gateway.component.transport.netty.extension.NettyHttpFilter;
import com.founder.gateway.component.transport.netty.extension.support.AbstractNettyHttpFilter;

public class NettyFilterChainManager {
	public static Map<String,AbstractNettyHttpFilter> filters=new ConcurrentHashMap<String,AbstractNettyHttpFilter>();
	static {
		for(String filterName:SetuExtensionLoader.getExtensionLoader(NettyHttpFilter.class).getSupportedExtensions()) {
			AbstractNettyHttpFilter filter=(AbstractNettyHttpFilter) SetuExtensionLoader.getExtensionLoader(NettyHttpFilter.class).getExtension(filterName);
			filter.setName(filterName);
			filters.put(filterName, filter);
		}
	}
	public static Map<String, AbstractNettyHttpFilter> getFilters() {
		return filters;
	}
	public static AbstractNettyHttpFilter getFilter(String name) {
		return filters.get(name);
	}
	
}
